-
Notifications
You must be signed in to change notification settings - Fork 557
(compat) Add PackageCommand to auto update layer compatibility generation #25670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds automated layer generation updates to the FluidFramework release process. The layer generation system provides compatibility tracking between different client layers (Loader, Driver, Runtime, Datastore) by incrementing a generation number monthly.
- Adds automated generation update logic during minor/major releases
- Creates auto-generated
layerGeneration.tsfile to track current generation and release date - Implements logic to calculate new generation based on months elapsed with compatibility window constraints
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| FluidRelease.fsl | Adds DoLayerGenerationUpdate step to release workflow after DoReleaseGroupBump |
| fluidReleaseStateHandler.ts | Registers the new doLayerGenerationUpdate handler in the state machine |
| doFunctions.ts | Implements the core layer generation update logic with file I/O and date calculations |
| (today.getTime() - previousReleaseDate.getTime()) / (1000 * 60 * 60 * 24), | ||
| ); | ||
|
|
||
| const monthsBetweenReleases = Math.floor(daysBetweenReleases / 30); |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a fixed 30-day month approximation is inaccurate for month calculations. Consider using date arithmetic that accounts for actual month boundaries, such as calculating the difference in months and years between the two dates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just use 100 days for 3 months, 200 for six months, and 400 for 12 months, etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to 33 days instead to 30. That should give a couple of days of buffer over the max of 31. let me know what you think.
| const match = fileContents.match( | ||
| /.*\nexport const generation = (\d+);[\n\r]*export const releaseDate = "((0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2})";.*/m, | ||
| ); |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern is complex and fragile. Consider parsing the TypeScript file using a proper parser or extracting the values using a more robust approach that doesn't rely on exact formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we control the packages, consider putting the date and time of release in the package itself then we can just read it from the previous version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean in the package.json?
052e6df to
61fde3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
Each layer within a client (Loader, Driver, Runtime and Datastore) has a generation property which should be incremented monthly. It provides a simple way to determine if two layers are compatible with each other by comparing their generations since layer compatibility is expressed in number of months. For example, between the Runtime and Datastore layers, we support a 3 months compatibility. So, they are compatible if the difference in their generation is <3. See #22877 for more details on how this will work.
This change adds an automated way to increment the generation of these layers for simplicity and consistency. Here is how it works:
PackageCommandcalledUpdateGenerationCommandis added. The flub commandflub generate:layerGenerationcan be run this command for a package.layerGenerationState.tsshould exist at thesrcfolder under a package directory.layerGenerationState.tsfile will be auto generated and contain the last release version, the last release date and the generation as per the last release.flub generate:layerGenerationfor a package, it will read the contents of itslayerGenerationState.tsfile, and update the generation (if needed) as follows:New generation = Old generation + no. of months since last release.New generation = Old generation + min (no. of months since last release, min. compat window between layers across all layer boundaries).flub generate:layerGenerationcommand will be added to the scripts inclient-utils'spackage.jsonfile in a subsequent PR. The generation information for all the layers will be present in this package. The associated chagnes to the build system to run this command on releases will also be added in a subsequent PR.AB#51926